package com.yejiali.backend.config.JackSon;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @Author:yejiali
 * @Date:2025/6/4-06-04-20:24
 * @Decsription:com.yejiali.backend.config.JackSon
 * @Version:1.0
 */
@Component
public class UserRoleSerializer extends JsonSerializer<String> {
    @Override
    public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        String role = s == "ROLE_AUDITOR" ? "初审员" : "复审员";
        jsonGenerator.writeString(role);
    }
}
